package service;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;

import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;

public class HttpService {


    public static void main(String[] args) throws UnsupportedEncodingException {

        String filePath = "/Users/shuidi/Desktop/saved.png";
        String url = "http://82.156.129.111:8081/image/upload/";

        File f1 = new File(filePath);
        HttpResponse response = HttpRequest.post(url)
                .form("photos", f1)
                .execute();
        System.out.println(response.getStatus());
        String res = new String(response.bodyBytes(),"UTF-8");
        System.out.println(res);

    }

}